!********************************************************************
!  BMN13U-J CCL file.
!    Copyright (C) 2007 NetIndex Inc. All Rights Reserved.
!
!  Ver.1.0.0  05/18/2007 OYAMA Takanobu
!********************************************************************
!	
@ORIGINATE
@ANSWER
!**************************************
! Serial Speed 115200 bps.  
!**************************************
serreset 115200, 0, 8, 1
!
!**********************
! reset
!**********************
HSReset 0 1 0 0 0 0
settries 0
!
!
!****************
! Initialize 1
!****************
@LABEL 1
DTRClear
pause 5
DTRSet
matchclr
matchstr 1 2 "OK\13\10"
write "AT\13"
matchread 30
inctries
iftries 2 82
!****************
flush
jump 1
!
!****************
! Initialize 2
!****************
@LABEL 2
matchclr
matchstr 1 4 "OK\13\10"
write "AT\13"
matchread 30
inctries
iftries 2 82
!****************
flush
jump 1
!
!****************
! check lock
!****************
@LABEL 4
settries 0
@LABEL 5
flush
matchclr
matchstr 1 15 "SECSTATE=0"
matchstr 2 6 "SECSTATE=1"
matchstr 3 6 "SECSTATE=2"
write "AT*I1:1\13"
matchread 30
jump 82
!
!****************
! locked
!****************
@LABEL 6
ask 2 "Lock for BMN13U-J was found. Please unlock."
exit -6008
!
!****************
! Initialize
!****************
@LABEL 15
flush
matchclr
matchstr 1 19 "OK"
matchstr 2 16 "ERROR"
write "AT*I2:0:0:0:0:2\13"
matchread 30
!
@LABEL 16
exit -6008
!
!****************
! dial Initialize
!****************
@LABEL 19
flush
matchclr
matchstr 1 20 "OK\13\10"
write "ATE0&D2&C1V1X4\\V1\\X1\13"
matchread 30
inctries
iftries 2 82
!****************
flush
jump 1
!
!
@LABEL 20
!*****************************************
! Initialize OK
!*****************************************
! this card dosen't support commpression or etc..
!
!
!***** Dialing *****
pause 2
write "ATD^3^7\13"
!
!*************************************
!    Connection Check
!*************************************
!
matchclr
matchstr 1  85 "RING\13\10"
matchstr 2  82 "NO CARRIER\13\10"
matchstr 3  82 "ERROR\13\10"
matchstr 4  83 "BUSY\13\10"
matchstr 5  84 "NO ANSWER\13\10"
matchstr 6  82 "DELAYED\13\10"
matchstr 7  30 "CONNECT"
matchread 700
jump 80
!
!
@LABEL 30
matchclr
matchstr 1 32 "240000 32kPIAFS\13\10"
matchstr 2 33 "240000 64kPIAFS BE\13\10"
matchstr 3 34 "240000 64kPIAFS GR\13\10"
matchstr 4 35 "240000 PACKET\13\10"
matchstr 5 36 "240000 MultiPACKET\13\10"
matchstr 6 37 "240000 64kAO/DI\13\10"
matchstr 7 32 "300000 32kPIAFS\13\10"
matchstr 8 33 "300000 64kPIAFS BE\13\10"
matchstr 9 34 "300000 64kPIAFS GR\13\10"
matchstr 10 35 "300000 PACKET\13\10"
matchstr 11 36 "300000 MultiPACKET\13\10"
matchstr 12 37 "300000 64kAO/DI\13\10"
matchread 30
jump 31
!
@LABEL 31
note "Connected..." 2
jump 70
!
@LABEL 32
note "Connected : 32k PIAFS" 2
CommunicatingAt 32000
jump 70
!
@LABEL 33
note "Connected : 64k PIAFS" 2
CommunicatingAt 64000
jump 70
!
@LABEL 34
note "Connected : 64k PIAFS" 2
CommunicatingAt 64000
jump 70
!
@LABEL 35
note "Connected : 1x Packet" 2
CommunicatingAt 32000
jump 70
!
@LABEL 36
note "Connected : 4x Packet" 2
CommunicatingAt 128000
jump 70
!
@LABEL 37
note "Connected : 64k FlexChange" 2
CommunicatingAt 64000
jump 70
!
!
!*****************************
! "CONNECT" & exit
!*****************************
!
@LABEL 70
HSReset 0 1 0 0 0 0
!
!pause 30
exit 0
!
!
!***************************************
! error messages - label range is 80-100
!***************************************
!
! Modem Not Responding
@LABEL 80
exit -6019
!
! No Dial Tone
@LABEL 81
exit -6020
!
! No Carrier or Error
@LABEL 82
exit -6021
!
! Busy
@LABEL 83
exit -6022
!
! No Answer
@LABEL 84
exit -6023
!
! varstring invalid value
@LABEL 85
exit -6027
!
!
!****************************************
! Hang up the modem - label range is 100-
!****************************************
!
@HANGUP
@LABEL 102
settries 0
HSReset 0 0 0 0 0 0
@LABEL 105
!
! Try to get control of the modem.
!
DTRSet
pause 5
DTRClear
flush
!
@LABEL 108
flush
matchclr
matchstr 1 111 "NO CARRIER\13\10"
matchstr 2 111 "OK\13\10"
matchstr 3 111 "ERROR\13\10"
write "ATH\13"
matchread 30
inctries
iftries 3 80
DTRSet
pause 5
DTRClear
pause 5
DTRSet
flush
!
@LABEL 109
matchclr
matchstr 1 115 "OK\13\10"
write "+++"
matchread 15
jump 108
!
! recall the factory settings.
!
@LABEL 111
pause 15
matchclr
matchstr 1 114 "OK\13\10"
write "AT&FS0=0\13"
matchread 30
jump 80
!
@LABEL 114
exit 0

@LABEL 115
pause 50
jump 108

!
! labels 121-128 are reserved for future emergency hacks
!